package com.yuw.threaddemo;

import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

public class TestDriver {
    public static void main(String[] args) {

        // 创建一个锁对象
        Lock lock = new ReentrantLock();
        // 枷锁条件对象
        Condition condition = lock.newCondition();
        // 创建要给仓库对象
        MyStack myStack = new MyStack(10, lock, condition);

        // 创建生产者线程对象，启动生产者线程
        ProducerThread producerThread = new ProducerThread(myStack);
        producerThread.start();
        // 创建消费者线程对象，启动消费者线程
        new Thread(new ConsumerThread(myStack)).start();

    }
}
